<template>
  <view>
    <web-view :src="src" v-if="src"></web-view>
  </view>
</template>

<script>
  export default {
    data() {
      return {
        src: "",
        title: "",
      };
    },

    onShareAppMessage() {
      const query = this.$queryParams({
        title: this.title,
        src: this.src,
      });
      return {
        title: this.title,
        path: "/pages/webview/webview" + query,
      };
    },
    onLoad({
      src,
      title
    }) {
      this.src = decodeURIComponent(src);
      if (title) {
        this.title = decodeURIComponent(title);
      }
    },
    onShow() {
      this.$setTitle(this.title);
    },
  };
</script>